package com.ndp.fb.rdb.db.impl;

import com.alibaba.dubbo.config.annotation.Service;
import com.ndp.fb.rdb.api.EcElementStyleRdbService;
import com.ndp.fb.rdb.db.DaoTemplate;
import com.ndp.fb.rdb.db.impl.mapper.DefaultRowMapper;
import com.ndp.fb.rdb.model.ectemplate.EcElementStyle;

import java.util.List;

/**
 * Created by evan on 2016/7/2.
 */
@Service
public class EcElementStyleRdbServiceImpl extends DaoTemplate implements EcElementStyleRdbService {

    @Override
    public Long save(EcElementStyle ecElementStyle) {
        return saveResultId(ecElementStyle);
    }

    @Override
    public List<EcElementStyle> findAll() {
        return findAll(DefaultRowMapper.autoRowMapper(EcElementStyle.class));
    }

    @Override
    public EcElementStyle findByCode(String styleCode) {
        String sql = "select * from ec_element_style where code = ?";
        return findOne(sql, new Object[]{styleCode}, DefaultRowMapper.autoRowMapper(EcElementStyle.class));
    }
}
